package com.incar.chuxing.utils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by 17310 on 2018/5/2.
 */

public class ThreadPool {
    /*
     * 线程池大小
     */
    private static int poolCount = Runtime.getRuntime().availableProcessors();

    // private static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(poolCount);
    private static ExecutorService cacheThreadPool = Executors.newCachedThreadPool();

    /**
     * 给线程池添加任务
     *
     * @param runnable 任务
     */
    public static void execute(Runnable runnable) {
        cacheThreadPool.execute(runnable);
    }
}
